# 9*9乘法表

# 1.把乘法表左上角考虑成（1，1）坐标点，每个乘法表达式 等于row*col
# 2.输出是一行一行输出的，所以每一行输出后需要换行
# 3.每一行的行号，就是看列从1到行号的循环
# 4.为了格式化输出，使用占位

for row in range(1,10):
    for col in range(1,row+1):
        print("{}*{}={:<4}".format(row,col,row*col),end=" ")
    print("")

print("")
print('='*60)
print("")

for row in range(9,0,-1):
    for col in range(1,row+1):
        print("{}*{}={:<4}".format(row,col,row*col),end=" ")
    print("")


print("")
print("=" * 60)
print("")

for row in range(1,10):
    for col in range(1,row):
        print(end="       ")
    for col in range(row,10):
        print("%d*%d=%2d"% (row,col,row*col),end = " ")
    print("")


print("")
print("=" * 60)
print("")

for row in range(1,10):
    for col in range(1,10-row):
        print(end="       ")
    for col in range(1,row+1):
        print("%d*%d=%2d"% (row,col,row*col),end=" ")
    print("")

print("")
print("=" * 60)
print("")


a = 1
while a < 10:
    b = 1
    while b <= a:
        print("%i*%i=%2i"% (a,b,a*b),end=" ")
        b = b + 1
    print("")
    a = a + 1

print("")
print("="*60)
print("")

a = 9
while a > 0:
    b = 1
    while b <= a:
        print("%i*%i=%2i"% (a,b,a*b),end=" ")
        b = b + 1
    print("")
    a = a - 1

print("")
print("="*60)
print("")

a = 1
while a <= 9:

    k = 1
    while k <= 9 - a:
        print('       ',end = '')
        k = k + 1
    b = 1
    while b <= a:
        print("%d*%d=%-2d"% (a,b,a*b),end = ' ')
        b = b + 1
    print("")
    a = a + 1

print("")
print("="*60)
print("")

a = 9
while a >= 1:
    k = 1
    while k <= 9-a:
        print('       ',end = '')
        k = k + 1
    b = 1
    while b <= a:
        print("%d*%d=%2d"% (a,b,a*b),end = ' ')
        b = b + 1
    print()
    a = a - 1